<html>
<body>
<input type="input" value="" id="cok2" />
<script src="./jquery-3.2.1.min.js">
//document.domain = "lucky.com" 
//document.getElementById("cok2").value = window;
//接收子页面的值
addEvent(window,'message',function(event) {
  event=event || window.event;
  console.log(event);
  if(event.data!=null) {
	document.getElementById("cok2").value = event.data;
  }
});

function addEvent(object, type, handler, remove){
   if(typeof object!='object'||typeof handler!='function') return;
   try{
      object[remove?'removeEventListener':'addEventListener'](type,handler,false);
   }catch(e){
       var xc='_'+type;
       object[xc]=object[xc]||[];
       if(remove){
           var l=object[xc].length;
           for(var i=0;i<l;i++){
                   if(object[xc][i].toString()===handler.toString()) object[xc].splice(i,1);
           }
       }else{
           var l=object[xc].length;
           var exists=false;
           for(var i=0;i<l;i++){
                   if(object[xc][i].toString()===handler.toString()) exists=true;
           }
           if(!exists) object[xc].push(handler);
       }
       object['on'+type]=function(){
           var l=object[xc].length;
           for(var i=0;i<l;i++){
                   object[xc][i].apply(object,arguments);
           }
       }
   }
}

function changeStyle(size){
	var x=document.getElementById("dfws_im");
  x.style.width=size ? '615px' : '300px';
  x.style.height=size ? '445px' : '40px';
}
</script>

</body>
</html>